import java.util.Random;

// Mainly a Demonstration of how Action can be extended and used
/**
*	Cleave is an Action that applies a secondary attack on a different member
* of the opposing party when the primary attack is successful.
*/
public class Cleave extends Action
{
	Action aSplash;
	/**
	* Duplicate of the Action Constructor.  It assumes that the splash effect is
	* a 1 point damage affect using the same bonuses and defense statistic (AC, 
	* etc...) as the primary attack
	*/
	public Cleave(int iMyMin, int iMyMax, int iMyAttacks, int iMyBonus)
	{
		Initialize(iMyMin, iMyMax, iMyAttacks, iMyBonus);
		aSplash = new Action(1,1,iAtkStat,iBonus);
	}
	/**
	* This Constructor lets you specify the details of the secondary attack which
	* is applied on success.  The second four parameters are used for the splash
	* attack.
	*/
	public Cleave(int iMyMin, int iMyMax, int iMyAttacks, int iMyBonus, int iSplashMin,
		int iSplashMax, int iSplashAtk, int iSplashBonus)
	{
		Initialize(iMyMin, iMyMax, iMyAttacks, iMyBonus);
		aSplash = new Action(iSplashMin,iSplashMax,iSplashAtk,iSplashBonus);
	}
	protected void doExActionSuccess(Combatant Target)
	{
		Party TParty = Target.getParty();
		Combatant OtherTarget = TParty.getROUnit(Target);
		if(OtherTarget != null)
		{
			String sMessage = OtherTarget.getName() + "is selected for cleave splash";
			Target.getParty().getEncounter().printLog(sMessage);
			aSplash.doAction(OtherTarget);
		}
		else
		{
			String sMessage = "No target available for Cleave's splash.";
			Target.getParty().getEncounter().printLog(sMessage);
		}
	}
}
